{include file="header.html"}
{if $user_id}
<div class="title tc ml-30 mr-10">
	<h2>个性需求提报单</h2>
</div>
<div class="content px-20">
<form name="myForm" id="myForm" action="/index.php?act=requitement&st=saveUserDemand" method="post">
	<section id="section1">
		<table class="my-10">
		    <tbody> 
		        <tr>
		            <td class="pl-10 tc"> 需求涉及产品</td><td class="pl-15"><input id="Product_Type" name="Product_Type" type="text"/><br/><font color='red' id='td_Product_Type'></font></td>
		        </tr>
		        <tr>
		            <td class="pl-10 tc"> 规格</td><td class="pl-15"><input id="Product_Spec" name="Product_Spec" type="text" /><br/><font color='red' id='td_Product_Spec'></font></td>
		        </tr>
		        <tr>
		            <td class="pl-10 tc"> 牌号</td><td class="pl-15"><input id="Product_Grade" name="Product_Grade" type="text" /><br/><font color='red' id='td_Product_Grade'></font></td>
		        </tr>
		        <tr>
		            <td class="pl-10 tc"> 需求数量</td><td class="pl-15"><input id="Product_Qty" name="Product_Qty" type="tel" style="width:120px" /> 吨（t）<br/><font color='red' id='td_Product_Qty'></font></td>
		        </tr>
		        <tr>
		            <td class="pl-20 tl" colspan="2">质量个性需求<br/>
		            	<textarea name="Demand_Quality" style="width:95%;height:50px" id="Demand_Quality"></textarea>
				<br/><font color='red' id='td_Demand_Quality'></font>
		            </td>
		        </tr>
		        <tr>
		            <td class="pl-20 tl" colspan="2">政策需求（价格、结算方式等)<br/>
		            	<textarea name="Demand_Policy" style="width:95%;height:50px" id="Demand_Policy"></textarea>
				<br/><font color='red' id='td_Demand_Policy'></font>
		            </td>
		        </tr>
		        <tr>
		            <td class="pl-20 tl" colspan="2">服务需求（物流运输、合同票据等)<br/>
		            	<textarea name="Demand_Service" style="width:95%;height:50px" id="Demand_Service"></textarea>
				<br/><font color='red' id='td_Demand_Service'></font>
		            </td>
		        </tr>		       
		    </tbody>
		</table>
		<p class="tc mt-10"><span id="btn_submit" class="btn w-150" style="display:inline-block"> 提&nbsp;&nbsp;&nbsp;&nbsp;交 </span>	</p>
	</section>
</form>
<script type="text/javascript">
$(function(){
	$("#btn_submit").click(function(){
		var Product_Type = $.trim($("#Product_Type").val());
		var Product_Spec = $.trim($("#Product_Spec").val());
		var Product_Grade = $.trim($("#Product_Grade").val());
		var Product_Qty = $.trim($("#Product_Qty").val());
		/* var Demand_Quality = $.trim($("#Demand_Quality").val());
		var Demand_Policy = $.trim($("#Demand_Policy").val());
		var Demand_Service = $.trim($("#Demand_Service").val()); */
		var errCount = 0;
		var errMsg = '';
		if(Product_Type == '') {
			errMsg = "请输入需求涉及产品！";
			$("#td_Product_Type").html(errMsg).show();;
			errCount = errCount+1;
		}
		if(Product_Spec == '') {
			errMsg = "请输入规格！";
			$("#td_Product_Spec").html(errMsg).show();;
			errCount = errCount+1;
		}
		if(Product_Grade == '') {
			errMsg = "请输入牌号！";
			$("#td_Product_Grade").html(errMsg).show();;
			errCount = errCount+1;
		}
		if(Product_Qty == '') {
			errMsg = "请输入需求数量！";
			$("#td_Product_Qty").html(errMsg).show();;
			errCount = errCount+1;
		}
		
		if(errCount == 0) {
			$("#myForm").submit();
		} else {
			return false;
		}		
	});
	$("input,textarea").change(function(){
		var obj = $(this).attr("id");
		var objVal = $.trim($("#"+obj).val());
		if(objVal != '') {
			$("#td_"+obj).hide();
		}
	});
});
</script>
</div>
{else}
<script type="text/javascript">
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
	alert('您好！您还未进行用户注册，不能享受此服务');
	WeixinJSBridge.call('closeWindow');
});
</script>
{/if}
{include file="footer.html"}